package com.thlws.mongo.controller;

import com.thlws.mongo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author HanleyTang 2019-06-21
 */
@RestController
public class DemoController {

    @Autowired
    private DemoService demoService;

    @RequestMapping("/insert")
    public Object insert(){
        return demoService.insert();
    }

    @RequestMapping("/update")
    public Object update(String userName,String phone){
        return demoService.update(userName,phone);
    }


    @RequestMapping("/delete")
    public Object delete(String userName,String phone){
        return demoService.remove(userName,phone);
    }


    @RequestMapping("/insertOrUpdate")
    public Object insertOrUpdate(String userName,String phone){
        return demoService.insertOrUpdate(userName,phone);
    }

}
